<!DOCTYPE html>
<html lang="en" class="dark">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="//unpkg.com/element-plus/dist/index.css" />
    <link
      rel="stylesheet"
      href="//unpkg.com/element-plus/theme-chalk/dark/css-vars.css"
    />
    <script src="./vue.js"></script>
    <script src="//unpkg.com/element-plus"></script>
    <script src="//unpkg.com/element-plus/dist/locale/zh-cn"></script>
    <style>
      .el-pagination.is-background .btn-next.is-active,
      .el-pagination.is-background .btn-prev.is-active,
      .el-pagination.is-background .el-pager li.is-active {
        background-color: orange;
      }
      .el-pagination.is-background .btn-next,
      .el-pagination.is-background .btn-prev,
      .el-pagination.is-background .el-pager li:hover {
        color: orange;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <el-pagination
        layout="prev, pager, next"
        :total="500"
        background
        :page-size="20"
        v-model:current-page="page"
      ></el-pagination>
      <h1>{{page}}</h1>
    </div>
  </body>
  <script>
    let app = Vue.createApp({
      data() {
        return {
          page: 5,
        };
      },
      watch: {
        page: {
          immediate: true,
          handler(val) {
            console.log("请求第" + val + "页数据");
          },
        },
      },
    });

    // mounted  beforeUnmount
    app = app
      .use(ElementPlus, {
        locale: ElementPlusLocaleZhCn,
      })
      .mount("#app");
  </script>
</html>
